% function result = xy_filter(im,im_filter)
r1 = ceil(size(im_filter,1)/2);c1 = ceil(size(im_filter,2)/2);
r2 = r1+size(im,1)-1;c2 = c1+size(im,2)-1;
temp_data = -9999*ones(size(im,1)+size(im_filter,1)-1,size(im,2)+size(im_filter,2)-1);
temp_data(:,1:(c1-1)) = 9999;
data = zeros(size(temp_data(:,:,1)));
for i = 1:3
    temp = temp_data;
    temp(r1:r2,c1:c2) = im(:,:,i);
    temp = filter2(filter_1,temp,'valid');
    data = data + temp;
end